import java.util.*;

public class Caculate {
    public String caculate(String r){
        Rational result=new Rational();
        OutOfStack calculate=new OutOfStack();
        result=calculate.evaluate(r); //运算出结果
        int a=result.getNumerator();//获得结果的分子
        int b=result.getDenominator();//获得结果的分母
        if (b==1){
            return String.valueOf(a);
        }
        else{
            return String.valueOf(a)+"/"+String.valueOf(b);
        }

    }
}
   

